//
// Created by denglibin on 2021/8/19.
//

#ifndef CPP_PROJECTS_HTTPCONTROLLER_H
#define CPP_PROJECTS_HTTPCONTROLLER_H

class HttpControllerBase
{
};


#include <iostream>
using namespace  std;
template <typename T>
class HttpController
{
public:
protected:
    static void registerMethod(){
        cout << "registerMethod" << endl;
    }

private:
    class methodRegistrator
    {
    public:
        methodRegistrator()
        {
            cout << "methodRegistrator" << endl;
            T::initPathRouting();
            T* t = new T();//创建对象
            cout << "methodRegistrator---2" << endl;
        }
    };

    static methodRegistrator registrator_;
    virtual void *touch()
    {
        return &registrator_;
    }
};

template <typename T>
typename HttpController<T>::methodRegistrator
        HttpController<T>::registrator_;


#endif //CPP_PROJECTS_HTTPCONTROLLER_H
